package com.slz3.business.module.goodsManagement.gooBaseGoodsAttributeValue.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.module.DomainEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.UUID;

import static javax.persistence.EnumType.STRING;

@MappedSuperclass
@Data
@EqualsAndHashCode(callSuper = false)
public class GooBaseGoodsAttributeValueEntity extends DomainEntity {

    private UUID memberUUID;

    /**
     * 编号
     */
    private String serNum;

    /**
     * 备注
     */
    @Basic(fetch = FetchType.LAZY)
    @Type(type = "text")
    private String serMemo;

    /**
     * 审核状态
     */
    @Enumerated(STRING)
    private AuditFlag serAudit = AuditFlag.APPROVED;

    /**
     * 启用状态
     */
    @Enumerated(STRING)
    private UsingFlag serUsing = UsingFlag.ENABLE;

    /**
     * 标签
     */
    private String serLabels;


    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private LocalDate serInputGroupData;

    @Column
    @NotNull(message = "fkGooAttributeValueUUID 必须非空!", groups = {Add.class})
    private UUID fkGooAttributeValueUUID;

    @NotBlank(message = "name 必须非空!", groups = {Add.class})
    private String name;

}
